using Microsoft.Practices.Unity;
using Blogger.UI.Data;
using Unity.Mvc4;
using System.Web.Mvc;
using System.Web.Http;
using System.Web.Http.Dependencies;
using System.Collections.Generic;
using System;
using POC.Azure.Storage;
using Blogger.UI.Controllers;
using Blogger.UI;
using POC.Azure.Bus;
using Blogger.UI;


namespace POC.IOC
{
    public static class Bootstrapper
    {
        public static void Initialise()
        {
            var container = BuildUnityContainer();
            var iocContainer = new IoCContainer(container);
            DependencyResolver.SetResolver(iocContainer);
        }

        private static IUnityContainer BuildUnityContainer()
        {
            var container = new UnityContainer();
          
            container.RegisterType<IBlogRepository, BlogRepository>();
            container.RegisterType<IPostingRepository, PostingRepository>();
            container.RegisterType<HomeController>();
            container.RegisterType<BlogUIController>();
            container.RegisterType<AzureAccount>();
            container.RegisterType<ICacheProvider>();
           
            // Regiter few instances
            container.RegisterInstance(AzureConfig.AzureAccount);
            container.RegisterInstance(new BlogRepository(AzureConfig.AzureAccount));
            container.RegisterInstance(new PostingRepository(AzureConfig.AzureAccount));
            container.RegisterInstance(new CacheProvider());
            return container;
        }
    }
   

  
}